package cn.stylefeng.guns.modular.business.frequency.orderpayrecord.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderpayrecord.service.OrderPayRecordService;
import cn.stylefeng.guns.modular.business.frequency.orderpayrecord.model.param.OrderPayRecordParam;

import javax.annotation.Resource;

/**
 * tt_order_pay_record 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderPayRecordController {

    @Resource
    private OrderPayRecordService orderPayRecordService;

    /**
     * 分页查询tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPayRecord/page")
    @BusinessLog(title = "tt_order_pay_record_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderPayRecordParam orderPayRecordParam) {
        return new SuccessResponseData(orderPayRecordService.page(orderPayRecordParam));
    }

    /**
     * 获取全部tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPayRecord/list")
    @BusinessLog(title = "tt_order_pay_record_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderPayRecordParam orderPayRecordParam) {
        return new SuccessResponseData(orderPayRecordService.list(orderPayRecordParam));
    }

    /**
     * 查看详情tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderPayRecord/detail")
    @BusinessLog(title = "tt_order_pay_record_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderPayRecordParam.detail.class) OrderPayRecordParam orderPayRecordParam) {
        return new SuccessResponseData(orderPayRecordService.detail(orderPayRecordParam));
    }

    /**
     * 添加tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPayRecord/add")
    @BusinessLog(title = "tt_order_pay_record_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderPayRecordParam.add.class) OrderPayRecordParam orderPayRecordParam) {
        orderPayRecordService.add(orderPayRecordParam);
        return new SuccessResponseData();
    }

    /**
     * 删除tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPayRecord/delete")
    @BusinessLog(title = "tt_order_pay_record_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderPayRecordParam.delete.class) OrderPayRecordParam orderPayRecordParam) {
        orderPayRecordService.delete(orderPayRecordParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑tt_order_pay_record
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPayRecord/edit")
    @BusinessLog(title = "tt_order_pay_record_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody  OrderPayRecordParam orderPayRecordParam) {
        orderPayRecordService.edit(orderPayRecordParam);
        return new SuccessResponseData();
    }

    /**
     * 修改状态
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderPayRecord/changeStatus")
    @BusinessLog(title = "tt_order_pay_record_修改状态", opType = LogAnnotionOpTypeEnum.CHANGE_STATUS)
    public ResponseData changeStatus(@RequestBody @Validated(OrderPayRecordParam.changeStatus.class) OrderPayRecordParam orderPayRecordParam) {
        orderPayRecordService.changeStatus(orderPayRecordParam);
        return new SuccessResponseData();
    }

}
